package org.lennon.util;

import java.io.Serializable;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
 * jackson 过滤方式 
 * 1. JsonIgnore  可定义在方法或者属性上，无论定义到哪里，改属性的写入与读取都被忽略
 * @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)  getterVisibility、setterVisibility
 * ANY  所有都可以  NONE所有都不可以
 *@JsonIgnoreProperties({"pageNo"})  同JsonIgnore，可以批量设置属性
 */
//@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PROTECTED_AND_PUBLIC)

public class PageInfo implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = 6377991265552215885L;
	private Integer pageNo = 1;//页码，默认是第一页
	private Integer pageSize = 15;//每页显示的记录数，默认是15
    
    private String[] checkeds; //选中行
    
	private Integer getPageNo() {
		if(pageNo!=null){
			return pageNo>0?pageNo:1;
		}else{
			return null;
		}
	}
	@JsonIgnore
	public Integer getPageNo_() {
		return getPageNo();
	}
	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}
	public void setPageNo_(Integer pageNo) {
		this.pageNo = pageNo;
	}
	private Integer getPageSize() {
		if(pageSize!=null){
			return pageSize>0?pageSize:15;
		}else{
			return null;
		}
	}
	@JsonIgnore
	public Integer getPageSize_() {
		return getPageSize();
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public void setPageSize_(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public String[] getCheckeds() {
		return checkeds;
	}
	public void setCheckeds(String[] checkeds) {
		this.checkeds = checkeds;
	}
	@Override
	public String toString() {
		return JSONObject.toJSONString(this);
	}
}



